<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title></title>
    <style type="text/css">

        body{ background:#EEEEEE;margin:0; padding:0; font-family:"微软雅黑", Arial, Helvetica, sans-serif; }

        a{ color:#006600; text-decoration:none;}

        a:hover{color:#990000;}

        .top{ margin:5px auto; color:#990000; text-align:center;}

        .info select{ border:1px #993300 solid; background:#FFFFFF;}

        .info{ margin:5px; text-align:center;}

        .info #show{ color:#3399FF; }

        .bottom{ text-align:right; font-size:12px; color:#CCCCCC; width:1000px;}

    </style>

</head>

<body>
<link rel="stylesheet" href="__PUBLIC__/css/pintuer.css">
<link rel="stylesheet" href="__PUBLIC__/css/admin.css">
<script src="__PUBLIC__/js/jquery.js"></script>
<script src="__PUBLIC__/js/pintuer.js"></script>
</head>
<body>
<form method="post" action="" id="listform">
    <div class="panel admin-panel">
        <div class="panel-head"><strong class="icon-reorder"> 内容列表</strong> <a href="" style="float:right; display:none;">添加字段</a></div>
        <div class="padding border-bottom">
            <ul class="search" style="padding-left:10px;">
                <li> <a class="button border-main icon-plus-square-o" href="__MODULE__/Img/add"> 添加内容</a> </li>
                <li>搜索：</li>
                <li>
                    <select id="s_province" name="s_province" class="input" onchange="changesearch()" style="width:100px; line-height:17px; display:inline-block">
                    </select>
                    &nbsp;&nbsp;
                    推荐
                    <select id="s_city" name="s_city"  class="input" onchange="changesearch()"  style="width:100px; line-height:17px;display:inline-block">
                    </select>
                    &nbsp;&nbsp;
                    置顶
                    <select id="s_county" name="s_county" class="input" onchange="changesearch()"  style="width:100px; line-height:17px;display:inline-block">
                    </select>
                </li>
                <script class="resources library" src="__PUBLIC__/area.js" type="text/javascript"></script>



                <script type="text/javascript">_init_area();</script>
                <div id="show"></div>
                <script type="text/javascript">

                    var Gid  = document.getElementById ;

                    var showArea = function(){

                        Gid('show').innerHTML = "<h3>省" + Gid('s_province').value + " - 市" +

                            Gid('s_city').value + " - 县/区" +

                            Gid('s_county').value + "</h3>"

                    }

                    Gid('s_county').setAttribute('onchange','showArea()');

                </script>
                <li>
                    <select name="cid" class="input" style="width:200px; line-height:17px;" onchange="changesearch()">
                        <option value="">请选择分类</option>
                        <option value="0">我是业主</option>
                        <option value="1">装修公司</option>
                    </select>
                </li>
                <li>
                    <input type="text" placeholder="请输入搜索关键字" name="keywords" class="input" style="width:250px; line-height:17px;display:inline-block" />
                    <a href="javascript:void(0)" class="button border-main icon-search" onclick="changesearch()" > 搜索</a></li>
            </ul>
        </div>
        <table class="table table-hover text-center">
            <tr>
                <th width="100" style="text-align:left; padding-left:20px;">ID</th>
                <th>姓名</th>
                <th>城市</th>
                <th>面积</th>
                <th>户型</th>
                <th>电话</th>
                <th>操作员</th>
                <th>添加时间</th>
                <th>操作</th>
            </tr>
            <volist name="list" id="vo">
                <foreach name="arr" item="v">
                    <tr>
                        <td style="text-align:left; padding-left:20px;"><input type="checkbox" name="id"/>{$v.id}</td>
                        <td>{$v.name}</td>
                        <td>{$v.city}</td>
                        <td>{$v.area}</td>
                        <td>{$v.huxing}</td>
                        <td>{$v.mobile}</td>
                        <td>{$v.operator}</td>
                        <td><?php echo date("Y-m-d H:i:s",$v["addtime"])?></td>
                        <td><div class="button-group">
                            <?php if($_SESSION['status']==1){?>
                            <a class="button border-main" href="<?=U("Baojia/update",array('id'=>$v['id']));?>"><span class="icon-edit"></span> 修改</a>
                            <a class="button border-red" href="javascript:void(0)" onclick=" del(<?php echo $v['id']?>)"><span class="icon-trash-o"></span>删除</a>
                            <?php }else{ ?>
                            你无权操作
                            <?php }?>
                        </div></td>
                    </tr>
                </foreach>

                <tr>
                    <td style="text-align:left; padding:19px 0;padding-left:20px;"><input type="checkbox" id="checkall"/>
                        全选 </td>
                    <td colspan="10" style="text-align:left;padding-left:20px;"><a class="button border-red icon-trash-o" style="padding:5px 15px;" href="javascript:void(0)" onclick="del({$v.id})"> 删除</a> <a href="javascript:void(0)" style="padding:5px 15px; margin:0 10px;" class="button border-blue icon-edit" onclick="sorts()"> 操作</a> </td>
                </tr>
                <tr>
                    <td colspan="10"><div class="pagelist">{$pageStr}</div></td>
                </tr>
        </table>
    </div>
</form>
<script type="text/javascript">

    //搜索
    function changesearch(){

    }

    //单个删除
    function del(id){
        var title = window.confirm('您确定要删除此条数据么？')
        if(title){
            $.ajax({
                type:'post',
                url:'__CONTROLLER__/del',
                data:{id:id},
                dataType:"json",
                success: function (data) {
                    if(data.msg==1){
                        alert("删除成功")
                        window.location.reload();
                    }
                },
                error:function(){
                    alert('删除失败')
                }
            })
        }else{

        }
    }

    //全选
    $("#checkall").click(function(){
        $("input[name='id[]']").each(function(){
            if (this.checked) {
                this.checked = false;
            }
            else {
                this.checked = true;
            }
        });
    })

    //批量删除
    function DelSelect(){
        var Checkbox=false;
        $("input[name='id[]']").each(function(){
            if (this.checked==true) {
                Checkbox=true;
            }
        });
        if (Checkbox){
            var t=confirm("您确认要删除选中的内容吗？");
            if (t==false) return false;
            $("#listform").submit();
        }
        else{
            alert("请选择您要删除的内容!");
            return false;
        }
    }

    //批量排序
    function sorts(){
        var Checkbox=false;
        $("input[name='id[]']").each(function(){
            if (this.checked==true) {
                Checkbox=true;
            }
        });
        if (Checkbox){

            $("#listform").submit();
        }
        else{
            alert("请选择要操作的内容!");
            return false;
        }
    }


    //批量首页显示
    function changeishome(o){
        var Checkbox=false;
        $("input[name='id[]']").each(function(){
            if (this.checked==true) {
                Checkbox=true;
            }
        });
        if (Checkbox){

            $("#listform").submit();
        }
        else{
            alert("请选择要操作的内容!");

            return false;
        }
    }

    //批量推荐
    function changeisvouch(o){
        var Checkbox=false;
        $("input[name='id[]']").each(function(){
            if (this.checked==true) {
                Checkbox=true;
            }
        });
        if (Checkbox){


            $("#listform").submit();
        }
        else{
            alert("请选择要操作的内容!");

            return false;
        }
    }

    //批量置顶
    function changeistop(o){
        var Checkbox=false;
        $("input[name='id[]']").each(function(){
            if (this.checked==true) {
                Checkbox=true;
            }
        });
        if (Checkbox){

            $("#listform").submit();
        }
        else{
            alert("请选择要操作的内容!");

            return false;
        }
    }


    //批量移动
    function changecate(o){
        var Checkbox=false;
        $("input[name='id[]']").each(function(){
            if (this.checked==true) {
                Checkbox=true;
            }
        });
        if (Checkbox){

            $("#listform").submit();
        }
        else{
            alert("请选择要操作的内容!");

            return false;
        }
    }

    //批量复制
    function changecopy(o){
        var Checkbox=false;
        $("input[name='id[]']").each(function(){
            if (this.checked==true) {
                Checkbox=true;
            }
        });
        if (Checkbox){
            var i = 0;
            $("input[name='id[]']").each(function(){
                if (this.checked==true) {
                    i++;
                }
            });
            if(i>1){
                alert("只能选择一条信息!");
                $(o).find("option:first").prop("selected","selected");
            }else{

                $("#listform").submit();
            }
        }
        else{
            alert("请选择要复制的内容!");
            $(o).find("option:first").prop("selected","selected");
            return false;
        }
    }

</script>
</body>
</html>